import React, { useState } from 'react'
import { Toast, NavBar, Switch, Cell } from 'react-vant';
import '../css/Hwj_index.css'
import { createFromIconfontCN } from '@react-vant/icons'
import { useNavigate } from 'react-router-dom';
const IconFont = createFromIconfontCN(
    '//at.alicdn.com/t/c/font_4695075_pl7cx9w2bje.js'
)
export default function Hwj_settings() {
    let navigate = useNavigate()
    let service_type = [
        { title: '关于隐私协议', path: '' },
        { title: '关于用户协议', path: '' },
        { title: '用户指南', path: '' },
        { title: '关于白菜出行', path: '' }
    ]
    const [value, setValue] = useState(false);
    const onChange = (checked) => {
        console.log(checked);
        setValue(checked);

    }
    return (
        <div id='settingsbox'>
            <NavBar
                title="设置"
                // leftText=""
                // rightText="按钮"
                onClickLeft={() => Toast(navigate('/app'))}
                onClickRight={() => Toast('按钮')}
            />
            <div className='con_1'>
                <Cell onClick={() => { navigate('/hwj_address') }} isLink title='常用地址' />
                <Cell
                    onClick={() => { navigate('') }}
                    value={
                        <Switch
                            checked={value} onChange={onChange}
                            activeColor="rgb(0, 226, 102)"
                            size="24px"
                            inactiveColor="#dcdee0"
                        // defaultChecked
                        />
                    }
                    title='实时路况' />
            </div>
            <div className='con_1'>
                <Cell onClick={() => { navigate('') }} value={<>211MB</>} isLink title='清除缓存' />
                <Cell onClick={() => { navigate('') }} value={<>V1.0.0</>} isLink title='检查版本更新' />
            </div>
            <div className='con_1'>
                {
                    service_type.map(item => (
                        <Cell key={item.title} onClick={() => { navigate(item.path) }} isLink title={item.title} />
                    ))
                }
            </div>
        </div>
    )
}
